/**
 * @(#) ReqMedicalMoneyWriteProxy.as
 *
 * @date		2011. 03. 19.
 * @version		1.0
 * @author		bgh
 * @description	 건강보험증 Proxy - Proxy
 * 				건강보험증  저장, 수정, 삭제한다.
 */
package com.skt.common_hr.healthchkreq.model
{
	import com.skt.common_hr.common.Variables;
	import com.skt.common_hr.common.puremvc.CommonProxy;
	import com.skt.common_hr.healthchkreq.model.vo.healthchkreqVO;
	import com.wcl.dataloader.*;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;

	public class ReqHealthchkreqWriteProxy extends CommonProxy
	{
		public static const NAME:String = "ReqHealthchkreqWriteProxy";
		/**
		 * 생성자
		 * @param
		 * @return void
		 */
		public function ReqHealthchkreqWriteProxy(data:Object=null)
		{
			super(NAME, data);
		}


		public function save(record:healthchkreqVO, sInsertType:String, setFunc:Function):void
		{
			var tables:Object 			= new Object();
			var table:Array = new Array();
			
			var params:Object 		= new Object();
			params["I_ACTIO"]		= sInsertType;
			params["I_PERNR"]		= Variables.myPernr;
			params["I_HENUM"]	= record.HENUM;
			
//											
//			var itab:Object 				= new Object();		
//			itab["TITLE"]				= record.I_TITLE;
//			itab["CONTENT"]		= record.I_CONTENT;
//			itab["CONTX"]			= record.I_CONTX;
//			
//			if(record.I_FILE_SIZE=="NaN") {
//				record.I_FILE_SIZE = '';
//			}
//			itab["FILE_SIZE"]		= record.I_FILE_SIZE;
//			itab["FILE_NAME"]	= record.I_FILE_NAME;
//			itab["FILE_EXT"]		= record.I_FILE_EXT; 
//			itab["FILE_URL"]		= record.I_FILE_URL;
			
			table.push(record);
			tables["ITAB"] = table;
			
			
			saveData("Z_HR_HE02", params, tables, insertResult, insertFault, setFunc);
		}

		public function insertResult(event:ResultEvent):void
		{
			if(retCode==0) {				
				event.result.func(this);
			}
			else {
				Alert.show(retText);
			}
		}

		private function insertFault(event:FaultEvent):void
		{
			Alert.show(retText);
		}	
	}
}